﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Meeting.Public;

namespace Meeting.Web.Admin.SelectBase
{
    /// <summary>
    /// SelectOperation 的摘要说明
    /// </summary>
    public class SelectOperation : IHttpHandler
    {

        string methodName = "";
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json;charset=utf-8";
            //context.Response.ContentType = "text/plain";
            methodName = context.Request.Params["method"];
            switch (methodName)
            {
                case "GetOAEmploy":
                    GetOAEmploy(context);
                    break;
                case "GetMeetingUser":
                    GetMeetingUser(context);
                    break;
                case "GetSubOffice":
                    GetSubOffice(context);
                    break;

            }
        } 
        //获取OAJson
        private void GetOAEmploy(HttpContext context)
        {
            BLL.Employee bll = new BLL.Employee();
            string role = context.Request.Params["role"];
            context.Response.Write(bll.GetOAEmploy(role));
        }

        //获取SubOffice Json
        private void GetSubOffice(HttpContext context)
        {
            BLL.SubOffice bll = new BLL.SubOffice();
            context.Response.Write(bll.GetSubOfficeJson(""));
        }

        private void GetMeetingUser(HttpContext context)
        {
            BLL.MeetingExt bll = new BLL.MeetingExt();
            string meetingId = CommonFunction.varToIntDef(context.Request["MeetingId"], 0).ToString();
            string name = CommonFunction.VarToStr(context.Request["Name"]);
            context.Response.Write(bll.GetSelEmployee(meetingId,name));

        }
        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}